import request from '@/utils/request'

export function getAllInfo() {
  return request({
    url: '/supplier/all',
    method: 'get'
  })
}
export function validList() {
  return request({
    url: '/supplier/validList',
    method: 'get'
  })
}

export function getInfo(query) {
  return request({
    url: '/scm/supplier/page1',
    method: 'get',
    params: query
  })
}
export function getdetail(query) {
  return request({
    url: '/scm/supplier/page1',
    method: 'get',
    params: query
  })
}
export function download(id) {
  return request({
    url: `/scm/on/supplier/downloadFile/${id}`,
    method: 'get',
    responseType: 'arraybuffer'
  })
}
export function add(data) {
  return request({
    url: '/supplier',
    method: 'post',
    data
  })
}

export function update(id, data) {
  return request({
    url: `/supplier/${id}`,
    method: 'put',
    data
  })
}

export function deleteInfo(id) {
  return request({
    url: `/supplier/${id}`,
    method: 'delete'
  })
}
export function supplierChange(data) {
  return request({
    url: `/scm/supplier/change/`,
    method: 'put',
    data
  })
}
export function getfile(id, data) {
  return request({
    url: `/scm/on/supplier/file/${id}`,
    method: 'get',
    params: data
  })
}
export function getinfor(data) {
  return request({
    url: '/scm/on/supplier/page',
    method: 'get',
    params: data
  })
}
export function impPpap(id, file) {
  return request({
    url: `/scm/supplier/uploadFile/${id}`,
    method: 'post',
    data: file
  })
}
export function downLoadfile(id) {
  return request({
    url: `/scm/supplier/downloadFile/${id}`,
    method: 'get',
    responseType: 'arraybuffer'
  })
}
export function getPpapFile(id) {
  return request({
    url: `/scm/on/supplier/file/${id}`,
    method: 'get'
  })
}

export function deletefile(id) {
  return request({
    url: `/scm/on/supplier/file/${id}`,
    method: 'delete'
  })
}
export function supplierChangeList(id) {
  return request({
    url: `/scm/supplier/supplierChangeList/${id}`,
    method: 'get'
  })
}
export function throwPage(data) {
  return request({
    url: `/scm/supplier/throw/page`,
    method: 'get',
    params: data
  })
}
export function throwCheck(data) {
  return request({
    url: `/scm/supplier/throw/check`,
    method: 'post',
    data
  })
}
export function companyList() {
  return request({
    url: `/company/list`,
    method: 'get'

  })
}
export function uploadSupplierInfor(id, file) {
  return request({
    url: `/scm/on/supplier/uploadFile2/${id}`,
    method: 'post',
    data: file
  })
}
export function getfileOnSupplier(id, data) {
  return request({
    url: `/scm/on/supplier/fileOnSupplier/${id}`,
    method: 'get',
    params: data
  })
}

export function supplierExpExcel(data) {
  return request({
    url: `/scm/supplier/expExcel`,
    responseType: 'arraybuffer',
    method: 'get',
    params: data
  })
}
// 供应商分类
export function getSupplierCategory(data) {
  return request({
    url: `/scm/supplier/category/page`,
    method: 'get',
    params: data
  })
}
export function addSupplierCategory(data) {
  return request({
    url: `/scm/supplier/category/operate`,
    method: 'put',
    data
  })
}
export function delSupplierCategory(id) {
  return request({
    url: `/scm/supplier/category/delete/${id}`,
    method: 'delete'
  })
}
export function upCategory() {
  return request({
    url: '/scm/category/getList',
    method: 'get'

  })
}
export function getNormalSupplier(supplierId) {
  return request({
    url: `/scm/contract/getNormalSupplierContractListBySypplierId/${supplierId}`,
    method: 'get'
  })
}
export function groupOwner(data) {
  return request({
    url: `/andon_group/onTjtmData`,
    method: 'get',
    params: data
  })
}
